home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: news.sprintlink.net!eskimo!scs
- From: scs@eskimo.com (Steve Summit)
- Subject: Re: What is &Variable (declared as: char Variable[10])?
- X-Nntp-Posting-Host: eskimo.com
- Message-ID: <DnyIGG.6xG@eskimo.com>
- Sender: news@eskimo.com (News User Id)
- Organization: schmorganization
- References: <4gvlnlINNppj@anvil.ugrad.cs.ubc.ca> <DnLx2r.323@eskimo.com> <TANMOY.96Mar2121557@qcd.lanl.gov>
- Date: Fri, 8 Mar 1996 16:14:39 GMT
-
- In article <TANMOY.96Mar2121557@qcd.lanl.gov>, tanmoy@qcd.lanl.gov
- (Tanmoy Bhattacharya) writes:
- > In article <DnLx2r.323@eskimo.com>
- > scs@eskimo.com (Steve Summit) writes:
- > SS: A client programmer might reasonably assume that the sequence
- > SS: abstract_t x; f(x);
- > SS: could not modify x. In C, this assumption is of course not valid
- > SS: if abstract_t happens to have array type.
- >
- > Sometime back in comp.std.c there was a post which demonstrated a
- > slightly different problem with abstract_t being an array type: the
- > following does not compile:
- >
- > void g(abstract_t *z){}
- > void f(abstract_t x){g(&x);}
- > int main {abstract_t y={0}; f(y);}
-
- Interesting! Actually, it isn't hard to convince yourself that
- there are an infinity of such examples: since arrays are
- "second-class types" in C; since the compiler is continually
- rewriting array references and declarations for you; you're
- obviously never going to get very far if you try to map an
- abstract, "black box" type to an array type.
-
- > (In that post the question was about va_list being such an abstract
- > type, but the problem is a general one.)
-
- Yeah. (va_list is a particularly sticky problem.)
-
- > SS: As it happens, standard C does contain one abstract type which
- > SS: is, underneath, an array: jmp_buf, from <setjmp.h>.
-
- That's an incomplete statement: there's not necessarily exactly
- one of these types; I think one of the peculiarities of va_list
- is that it's allowed to be an array type, too.
-
- > SS: ...since setjmp must modify its
- > SS: argument, we are left with the peculiar requirement that jmp_buf,
- > SS: though seemingly abstract, must be an array type.
- >
- > No. The standard specifies that setjmp may be a macro... As a
- > macro can modify its argument, no requirement on jmp_buf actually
- > exists.
-
- Well, yes and no. Now that you mention it, it's a tiny bit unclear
- whether setjmp may be or must be a macro. Section 4.6.1.1 (old ANSI
- numbering) calls it a macro, but section 4.6 says that it's
- unspecified whether it's "a macro or an identifier declared with
- external linkage."
-
- jmp_buf, however, is specified (again, in sec. 4.6) as being an
- array type, even if not for the reason I mentioned.
-
- Steve Summit
- scs@eskimo.com
-